|
S3 is a structured, imperative high-level computer programming language. It was developed by the UK company International Computers Limited (ICL) for its 2900 Series mainframes. It is a system programming language with syntax influenced by ALGOL 68 but with data types and operators aligned to those offered by the 2900 Series. It was the implementation language of the operating system VME. ==Annotated Example== A rare example of an S3 program available in the public domain is the implementation of Kermit developed at the South-West Universities Regional Computer Centre, and archived in the Columbia University archive of Kermit implementations. The examples below are selected highlights of the main module (kmt_main_module). The program starts with a module identification, and comments which we quote by way of acknowledgment to the authors: MODULE KMT_MAIN_MODULE; @ Version 1.01 @ @------------------------------------------------------------------------------@ @ @ @ @ @ ----- S W U R C C V M E K E R M I T ----- @ @ @ @ @ @ ---------------------------------------------------------------- @ @ @ @ @ @ Version 1.00 (February 1986) @ @ @ @ Written by : Richard Andrews and David Lord, @ @ South West Universities Regional Computer Centre, @ @ Claverton Down, Bath BA2 7AY, U.K. @ @ @ @ @ @ ---------------------------------------------------------------- @ @ @ @ @ @ Version 1.01 (October 1986) @ @ @ @ Fixes by : Dave Allum and David Lord, SWURCC. @ @ ---------------------------------------------------------------- @ Next follow a number of "mode declarations". Mode is the Algol 68 term for a type. The first type is an array of 96 bytes; the next two are references (pointers) to arrays of bytes. KMT_MTM_VALUES is a union type allowing a variety of different types to appear. Note that WORD is a 32-bit unsigned integer, INT is a 32-bit signed integer; LONG makes it 64 bits. The last option in the union is marked REF()REF()BYTE, which means it is a pointer to an array whose members are pointers to arrays of bytes. The final type declared here is a STRUCT, specifically a tuple containing two integers. The program continues by declaring external procedures on which the module depends. RESPONSE indicates a return value containing error information: and also some external variables: The rest of the program consists of a number of procedure definitions. One of these, which actually defines the entry point to the program, is reproduced here: Features to note here include: * The declaration of the procedure is decorated with annotations that define a command line syntax allowing the program to be called from SCL, or used from an interactive shell with prompting for default parameter values. * Procedure calls prefixed CTM are calls to the "Common Target Machine", an API offered by the VME operating system. * "JSV" means "job space variable", VME's term for an environment variable, and the call on CTM_JS_READ reads the value of the variable. * UNLESS means "if not"; ELSF means "else if". * LONG LONG WORD declares a 128-bit integer, which is a native type supported by the 2900 architecture * The bulk of the processing is delegated to another procedure, KERMIT_SUPPORT, which can be found in the same module. This is called indirectly via the operating system CTM_JS_CALL, similar to an exec() call on Unix systems; this ensures clean failure handling and tidying up of any resources in the event of a fatal error. The PDESC keyword constructs a "procedure descriptor": essentially it treats KERMIT_SUPPORT as a first-class function which can be passed as an argument to another function, making CTM_JS_CALL a higher-order function that calls its supplied argument with appropriate error handling. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「S3 (programming language)」の詳細全文を読む スポンサード リンク
|